import Vue from 'vue'
import App from './App.vue'
import router from './router/index.js'

Vue.config.productionTip = false

import singleSpaVue from 'single-spa-vue';

const appOptions = {
  el: '#vue', // 挂在父应用id为vue的标签位置
  router,
  render: h => h(App)
}

// 在非子应用中正常挂载应用
if (!window.singleSpaNavigate) {
  delete appOptions.el;
  new Vue(appOptions).$mount('#app');
}

const vueLifeCycle = singleSpaVue({
  Vue,
  appOptions
});

// 协议接入
// 子应用必须导出 以下生命周期 bootstrap、mount、unmount
// 子应用还需要打包成一个个的lab给父应用使用
export const bootstrap = vueLifeCycle.bootstrap;
export const mount = vueLifeCycle.mount;
export const unmount = vueLifeCycle.unmount;

export default vueLifeCycle;
